import { Inject, Post, Body, Query, Get } from '@midwayjs/core';
import {
  CoolController, BaseController, TagTypes,
  CoolTag
} from '@cool-midway/core';
import { NursingPersonEntity } from '../../../nursing/entity/person';
import { NursingAppPersonService } from '../../service/nursing';
import { DictInfoService } from '../../../dict/service/info'

/**
 * 被护理人信息
 */
@CoolController({
  api: [],
  entity: NursingPersonEntity,
  service: NursingAppPersonService,
})
export class AppNursingPersonController extends BaseController {
  @Inject()
  nursingAppPersonService: NursingAppPersonService;

  @Inject()
  dictInfoService: DictInfoService;


  @Inject()
  ctx;


  @Get("/getNursing", { summary: "获取护理人" })
  async getNursing(@Query() BodyData: any) {
    return this.ok(await this.nursingAppPersonService.getNursing(BodyData));
  }

  @Post("/nursingCreate", { summary: "新增护理人" })
  async nursingCreate(@Body() BodyData: any) {
    return this.ok(await this.nursingAppPersonService.nursingCreate(BodyData));
  }

  @Post("/nursingDelete", { summary: "新增护理人" })
  async nursingDelete(@Body() BodyData: any) {
    return this.ok(await this.nursingAppPersonService.nursingDelete(BodyData));
  }

  @Post("/nursingUpdate", { summary: "修改护理人" })
  async nursingUpdate(@Body() BodyData: any) {
    return this.ok(await this.nursingAppPersonService.nursingUpdate(BodyData));
  }

  // 获取护理人员列表
  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Get("/getNursingStaff", { summary: "获取护理人员" })
  async getNursingStaff(@Query() BodyData: any) {
    return this.ok(await this.nursingAppPersonService.getNursingStaff(BodyData));
  }

  // 获取服务类别
  // 微信支付回调
  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Get("/getServiceType", { summary: "获取服务类别" })
  async getServiceType(@Query() BodyData: any) {
    let ds = await this.dictInfoService.data(["NursingType"])
    return this.ok(await this.nursingAppPersonService.getServiceType(BodyData));
  }
}
